/**
 @Name：layuiAdmin 开标项目列表
 @Author：star1029 
 @License：LPPL    
 */
layui.define(['table', 'form'], function(exports){
  var $ = layui.$
  ,table = layui.table
  ,form = layui.form;

  //帖子管理
  table.render({
    elem: '#LAY-app-sysmangprojectdaybidlist-list'
    ,url: layui.setter.base + 'json/sysmangprojectdaybidlist/list.js' //模拟接口
    ,cols: [[
      {title: '操作', align: 'center',width:220, fixed: 'right', toolbar: '#table-sysmangprojectdaybidlist-list'}
      ,{field: 'id', width: 100, title: 'ID', hide : true}
      ,{field: 'BDMC', title: '标段名称',edit:'text'}       
      ,{field: 'pbleader', title: '评标专家', width:250,}      
      ,{field: 'BidUnitname', title: '投标单位', width:250,}  
      ,{field: 'stateName', width: 100, title: '是否评标'}    
      ,{field: 'stateFile', title: '是否已选择评分表', width:240}
      
    ]]
    ,page: true
    ,limit: 10
    ,limits: [10, 15, 20, 25, 30]
    ,text: '对不起，加载出现异常！'
  });
  
  //监听工具条
  table.on('tool(LAY-app-sysmangprojectdaybidlist-list)', function(obj){
    var data = obj.data;   
     /*if(obj.event === 'openbid'){
      var tr = $(obj.tr);
      layer.open({
        type: 2
        ,title: data.XMMC
        ,content: '../../views/sysmang/sysmangprojectdaybidlistbid.html'
        ,area: ['800px', '600px']
        ,btn: ['保存', '关闭']
        ,resize: false
        ,yes: function(index, layero){
          var iframeWindow = window['layui-layer-iframe'+ index]
          ,submitID = 'LAY-app-sysmangprojectdaybidlist-submit'
          ,submit = layero.find('iframe').contents().find('#'+ submitID);
          //监听提交
          iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
            var field = data.field; //获取提交的字段
            //提交 Ajax 成功后，静态更新表格中的数据
            //$.ajax({});
            table.reload('LAY-app-sysmangprojectdaybidlist-list'); //数据刷新
            layer.close(index); //关闭弹层
          });  
          
          submit.trigger('click');
        }
        ,success: function(layero, index){
          
        }
      }
      
      );
    }*/
    var statusID;
    if(data.statusName=="是")
    {
      statusID="1";
    }
    else if(data.stateName=="否")
    {
      statusID="0";
    }
    if(obj.event=="openbid")
    {
      var postkey= "?statusID="+statusID+"&BDBM="+data.id+"";
      var url = '../../views/sysmang/sysmangprojectdaybidlistbiddetail.html'+postkey;
      window.open(url);
    }
  });
  
  exports('sysmangprojectdaybidlist', {})
});